﻿//
// Created by francklinson on 2021/3/28.
//

#include "Classic.h"

Classic::Classic(const char *w, const char *s1, const char *s2, int n, double x)
        : Cd(s1, s2, n, x)
{
    works = new char[strlen(w) + 1];
    strcpy(works, w);

}

Classic::~Classic()
{
    delete[]works;
}

void Classic::Report() const
{
    cout << "Classic report:" << endl;
    cout << "works: " << works << endl;
    Cd::Report();
    cout << endl;
}

Classic &Classic::operator=(const Classic &c)
{
    if (this == &c)
        return *this;
    delete[] works;
    Cd::operator=(c);
    works = new char[std::strlen(c.works) + 1];
    std::strcpy(works, c.works);

    return *this;
}
